﻿<mpc:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mpc="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
	xmlns:NYTimes="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit" 
    xmlns:NYTimes_ValueConverters="clr-namespace:NYTimes.ValueConverters;assembly=NYTimesSilverlightKit" xmlns:NYTimes_Data="clr-namespace:NYTimes.Data;assembly=NYTimesSilverlightKit" 
    xmlns:NYTMovieReviews_ValueConverters="clr-namespace:NYTMovieReviews.ValueConverters" 
    x:Class="NYTMovieReviews.Options" 
    SupportedOrientations="PortraitOrLandscape"
	d:DataContext="{d:DesignInstance NYTimes:MovieReviewsByKeyword, IsDesignTimeCreatable=True}"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480" Orientation="Portrait">
	<mpc:PhoneApplicationPage.Resources>
		<NYTMovieReviews_ValueConverters:MovieOrderConverter x:Key="MovieOrderConverter"/>
		<NYTimes_ValueConverters:TagConverter x:Key="TagConverter"/>
		<Style x:Key="PhoneToggleButtonBase" TargetType="ToggleButton">
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ToggleButton">
						<Border x:Name="LayoutRoot" Background="Transparent">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="foregroundContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="CheckStates">
									<VisualState x:Name="Unchecked"/>
									<VisualState x:Name="Checked">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="CheckedContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="foregroundContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border x:Name="CheckedContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}">
								<ContentControl x:Name="foregroundContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Border>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="PhoneRadioButtonCheckBoxBase" BasedOn="{StaticResource PhoneToggleButtonBase}" TargetType="ToggleButton">
			<Setter Property="Background" Value="{StaticResource PhoneBorderBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource PhoneBorderBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
			<Setter Property="MinWidth" Value="160"/>
			<Setter Property="MinHeight" Value="56"/>
			<Setter Property="Padding" Value="0"/>
		</Style>
		<Style x:Key="ThreeStateCheckBoxStyle" BasedOn="{StaticResource PhoneRadioButtonCheckBoxBase}" TargetType="CheckBox">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="CheckBox">
						<Grid Background="Transparent">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal">
										<Storyboard>
											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmark"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmarkDisabled"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="rectBackground">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource PhoneForegroundColor}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="Background" Storyboard.TargetName="rectBackground">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource PhoneForegroundColor}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="rectBackground">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource PhoneInactiveBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="Background" Storyboard.TargetName="rectBackground">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmark"/>
											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="imgCheckboxCheckmarkDisabled"/>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Foreground)" Storyboard.TargetName="foregroundContainer">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource PhoneInactiveBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="CheckStates">
									<VisualState x:Name="Checked">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmark">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmarkDisabled">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Unchecked">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmark">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgCheckboxCheckmarkDisabled">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Indeterminate">
										<Storyboard>
											<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="foregroundContainer" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectBackground" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Grid x:Name="controlBackground" Margin="{StaticResource PhoneTouchTargetOverhang}">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="32"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<Border x:Name="rectBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="Left" Height="32" VerticalAlignment="Center" Width="32"/>
								<Path x:Name="imgCheckboxCheckmarkDisabled" Data="F1 M 54.6819,26.2721L 57.2157,25.071L 60.1569,28.625C 60.6062,28.7067 61.0556,28.7884 61.8726,27.8693C 62.6895,26.9501 63.8742,25.0302 65.2631,23.2328C 66.652,21.4354 68.2451,19.7606 70.0016,18.1674C 71.7582,16.5743 73.6781,15.0629 75.598,13.5514L 76.9461,14.2867C 74.6993,16.3292 72.4526,18.3717 70.6489,20.3502C 68.8451,22.3287 67.4844,24.2432 66.0138,26.4491C 64.5432,28.655 62.9628,31.1522 61.3824,33.6495C 60.6879,33.772 59.9935,33.8946 59.3807,33.3227C 58.768,32.7508 58.2369,31.4844 57.4674,30.1936C 56.6979,28.9028 55.6899,27.5874 54.6819,26.2721 Z " Fill="{StaticResource PhoneInactiveBrush}" HorizontalAlignment="Left" Height="21" Margin="5,0,0,0" Stretch="Fill" Stroke="{StaticResource PhoneInactiveBrush}" StrokeLineJoin="Round" Visibility="Collapsed" VerticalAlignment="Center" Width="23"/>
								<Path x:Name="imgCheckboxCheckmark" Data="F1 M 54.6819,26.2721L 57.2157,25.071L 60.1569,28.625C 60.6062,28.7067 61.0556,28.7884 61.8726,27.8693C 62.6895,26.9501 63.8742,25.0302 65.2631,23.2328C 66.652,21.4354 68.2451,19.7606 70.0016,18.1674C 71.7582,16.5743 73.6781,15.0629 75.598,13.5514L 76.9461,14.2867C 74.6993,16.3292 72.4526,18.3717 70.6489,20.3502C 68.8451,22.3287 67.4844,24.2432 66.0138,26.4491C 64.5432,28.655 62.9628,31.1522 61.3824,33.6495C 60.6879,33.772 59.9935,33.8946 59.3807,33.3227C 58.768,32.7508 58.2369,31.4844 57.4674,30.1936C 56.6979,28.9028 55.6899,27.5874 54.6819,26.2721 Z " Fill="{StaticResource PhoneBackgroundBrush}" HorizontalAlignment="Left" Height="21" Margin="5,0,0,0" Stretch="Fill" Stroke="{StaticResource PhoneBackgroundBrush}" StrokeLineJoin="Round" Visibility="Collapsed" VerticalAlignment="Center" Width="23"/>
								<ContentControl x:Name="foregroundContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="12,0,0,0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</mpc:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
        <Grid.RowDefinitions>
        	<RowDefinition Height="170"/>
        	<RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--This is the name of the application and page title-->
        <Grid Grid.Row="0" x:Name="TitleGrid">
            <TextBlock x:Name="ApplicationName" Text="New York Times Movie Reviews" Style="{StaticResource PhoneTextTitle1Style}"/>
            <TextBlock x:Name="ListName" Text="Options" Style="{StaticResource PhoneTextTitle2Style}"/>
        </Grid>

        <!--This section is empty. Place new content here Grid.Row="1"-->
        <Grid Grid.Row="1" x:Name="ContentGrid">
        	<StackPanel Orientation="Vertical" VerticalAlignment="Top">
        		<Border VerticalAlignment="Center" Padding="2,4,2,2" Margin="10,0,0,0">
        			<Border.Background>
        				<LinearGradientBrush EndPoint="0.999,1.037" StartPoint="0.022,1.002">
        					<GradientStop Offset="1"/>
        					<GradientStop Color="White" Offset="0.316"/>
        				</LinearGradientBrush>
        			</Border.Background>
        			<Image Source="{Binding Logo, Mode=OneWay}" HorizontalAlignment="Left" VerticalAlignment="Center" Width="153" Height="23"/>
        		</Border>
        		<CheckBox x:Name="CriticsPicks" Content="Limit to NYT Critics' Picks" IsChecked="{Binding CriticsPicks, Mode=TwoWay}" IsThreeState="True" Style="{StaticResource ThreeStateCheckBoxStyle}"/>
        		<CheckBox x:Name="BestThousand" Content="Limit to Best 1,000 Movies" IsChecked="{Binding ThousandBest, Mode=TwoWay}" IsThreeState="True" Style="{StaticResource ThreeStateCheckBoxStyle}"/>
        		<CheckBox x:Name="DVDReleases" Content="Limit to DVD Releases" IsThreeState="True" IsChecked="{Binding DVD, Mode=TwoWay}" Style="{StaticResource ThreeStateCheckBoxStyle}"/>
        		<Grid Margin="20,0">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition/>
        				<ColumnDefinition Width="Auto"/>
        				<ColumnDefinition Width="Auto"/>
        			</Grid.ColumnDefinitions>
        			<Slider Minimum="10" Maximum="100" SmallChange="5" LargeChange="10" Value="{Binding ResultsToGet, Mode=TwoWay}" d:LayoutOverrides="Width, Height" Margin="0,0,10,0"/>
        			<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding ResultsToGet}" d:LayoutOverrides="Height" Grid.Column="1" Style="{StaticResource PhoneTextNormalStyle}"/>
        			<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text=" Results" d:LayoutOverrides="Height" Grid.Column="2" Style="{StaticResource PhoneTextNormalStyle}"/>
        		</Grid>
        	</StackPanel>
        	<TextBlock TextWrapping="Wrap" Text="{Binding Copyright, Mode=OneWay}" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextSmallStyle}" Margin="20,0,20,10" TextAlignment="Center"/>
        </Grid>
    </Grid>
</mpc:PhoneApplicationPage>